package me.jtx.poplar.core.exception.validation;

/**
 * Class to throw a NullValidationException if an object fails the null value
 * check
 *
 * @author: Tong Huazhong(jsyzthz@gmail.com)
 * @copyright: &copy; 2016, Tong Huazhong
 */
public class NullValidationException extends ValidationException {
	private static final long serialVersionUID = -1646809610491231827L;
	private String name;

	/**
	 * Constructor class to initialize the exception
	 *
	 * @param name
	 *            Name of the object that failed validation, to show in the
	 *            message
	 */
	public NullValidationException(String name) {
		this.name = name;
	}

	@Override
	public String getMessage() {
		return "The object " + name + " cannot be \'null\'. This fails null validation.";
	}

}
